package com.swz.dcrm.ui.base;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.widget.Toast;

import com.swz.dcrm.R;

public class BaseActivity extends AppCompatActivity {

    private Toast mToast;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
      //  setContentView(R.layout.activity_base);
    }

    public void showToast(String s){
        if(mToast==null){
            mToast= Toast.makeText(this,s,Toast.LENGTH_SHORT);
            mToast.setGravity(Gravity.CENTER,0,0);
        }else {
            mToast.setText(s);
        }

        mToast.show();
    }
    public   int getStatusBarHeight(Context context) {
        int result = 0;
        int resId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
        if (resId > 0) {
            result = context.getResources().getDimensionPixelOffset(resId);
        }
        return result;
    }
}
